package com.hkd.user_api.controller.base;

import com.hkd.base_service.api.AreaService;
import com.hkd.base_service.api.vo.AreaGetVo;
import com.hkd.common.api.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 省市区相关
 *
 * @author HKD
 * @date 2022/9/11 14:35
 */
@RestController
@Api(tags = "省市区相关")
@RequestMapping("area")
public class AreaController {
    @Autowired
    private AreaService areaService;

    @GetMapping("getAll")
    @ApiOperation("获取省市区信息，根据省市区编码")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "areaCode", value = "省市区编码", dataType = "string", paramType = "query")
    })
    public ApiResponse<List<AreaGetVo>> getAll(@RequestParam(value = "areaCode", required = false) String areaCode) {
        return areaService.getAll(areaCode);
    }
}
